formal grammar

Terms from Artificial Intelligence: humans at the heart of algorithms

A formal grammar is a set of fixed rules that define the valid constructions in a languages. This may be used in natural language processing to model an existing language. It may also be used to define an artificial language, in particular for programming languages.

Portion of formal grammar for a simple programming language:


expression ::== expression | expression operator expression | '(' expression ')'
statement ::== 'IF' expression 'THEN' statements 'ELSE' statments 'FI' | 'LET' variable '=' expression
statements ::== statement | statement ';' statements

xxx

Used in Chap. 13: pages 200, 202